package iceworld.fernado.file.impl;

import iceworld.fernado.consts.Constants;
import iceworld.fernado.file.ISaveResource;

public abstract class AbstractSaveResource implements ISaveResource {

	protected String generateTableName(String tableName) {
		int j = 0;
		char[] chars = tableName.toCharArray();
		for (int i = chars.length - 1; i > 0; i--) {
			j++;
			if (chars[i] > 128) {
				break;
			}
		}
		return tableName.substring(chars.length - j + 1);
	}
	
	protected String formatClazzName(String clazzName) {
		int underLine = clazzName.indexOf(Constants.UNDER_LINE);
		while (underLine > -1) {
			clazzName = clazzName.replace(Constants.UNDER_LINE, Constants.EMPTY_STRING);
			underLine = clazzName.indexOf(Constants.UNDER_LINE);
		}
		return clazzName;
	}
}
